package com.yjc.drygoods.ware.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yjc.common.utils.PageUtils;
import com.yjc.common.utils.Query;

import com.yjc.drygoods.ware.dao.InventoryAlertsDao;
import com.yjc.drygoods.ware.entity.InventoryAlertsEntity;
import com.yjc.drygoods.ware.service.InventoryAlertsService;
import org.springframework.util.StringUtils;


@Service("inventoryAlertsService")
public class InventoryAlertsServiceImpl extends ServiceImpl<InventoryAlertsDao, InventoryAlertsEntity> implements InventoryAlertsService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<InventoryAlertsEntity> queryWrapper = new QueryWrapper<>();
        String spuName = (String) params.get("spuName");
        if (!StringUtils.isEmpty(spuName)) {
            queryWrapper.like("spu_name", spuName);
        }
        String processStatus = (String) params.get("processStatus");
        if (!StringUtils.isEmpty(processStatus)) {
            queryWrapper.eq("process_status", processStatus);
        }
        IPage<InventoryAlertsEntity> page = this.page(
                new Query<InventoryAlertsEntity>().getPage(params),
                queryWrapper
        );

        return new PageUtils(page);
    }


}